/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cinemasystem.services.crud.impl;

import com.cinemasystem.model.MovieTechnology;
import com.cinemasystem.repository.GenericDAO;
import com.cinemasystem.services.crud.MovieTechnologyCrudService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author Avela
 */
@Service("movieTechnologyCrudService")
@Transactional
public class MovieTechnologyCrudServiceImpl implements MovieTechnologyCrudService{

    @Autowired
    private GenericDAO< MovieTechnology> dao;
    
     public final void setDao(final GenericDAO< MovieTechnology> daoToSet){
         this.dao = daoToSet;
         this.dao.setClazz(MovieTechnology.class);
     }
    @Override
    public MovieTechnology findById(Long id) {
         setDao(dao);
         return dao.findById(id);
    }

    @Override
    public List<MovieTechnology> findAll() {
        setDao(dao);
        return dao.findAll();
    }

    @Override
    public void persist(MovieTechnology entity) {
         setDao(dao);
         dao.persist(entity);
    }

    @Override
    public void merge(MovieTechnology entity) {
         setDao(dao);
         dao.merge(entity);
    }

    @Override
    public void remove(MovieTechnology entity) {
         setDao(dao);
         dao.remove(entity);
    }

    @Override
    public void removeById(Long entityId) {
         setDao(dao);
         MovieTechnology m = dao.findById(entityId);
         dao.removeById(entityId);
    }

    @Override
    public List<MovieTechnology> findInRange(int firstResult, int maxResults) {
        setDao(dao);
        return dao.findInRange(firstResult, maxResults);
    }

    @Override
    public long count() {
        setDao(dao);
        return dao.count();
    }

    @Override
    public MovieTechnology getByPropertyName(String name, String value) {
        setDao(dao);
        return dao.getByPropertyName(name, value);
    }

    @Override
    public List<MovieTechnology> getEntitiesByProperName(String name, String value) {
        setDao(dao);
        return dao.getEntitiesByProperName(name, value);
    }
    
}
